package kr.co.mustgo.model.service.freeboard;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import kr.co.mustgo.domain.freeboard.FreeComment;
import kr.co.mustgo.domain.freeboard.FreeBoard;
import kr.co.mustgo.model.dao.freeboard.CommentDAO;
import kr.co.mustgo.util.BoardUtilities;
import kr.co.mustgo.util.PagingBean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CommentServiceImpl implements CommentService{

	@Autowired
	private CommentDAO commentDAO;
	
	@Override
	public void writeContent(FreeComment comment) {
		String c = BoardUtilities.changeContentForDB(comment.getContents());
		comment.setContents(c);
		commentDAO.insertComment(comment);
	}


	@Override
	public Map getCommentList(int code) {
		HashMap map = new HashMap();
		List<FreeComment>list = commentDAO.selectCommentList(code);
		map.put("list", list);
		return map;
	}


	@Override
	public void deleteContentByreCode(int reCode) {
		commentDAO.deleteComment(reCode);		
	}

	
}
